package com.hspedu.interface_;

import org.omg.CosNaming.IstringHelper;

public class ExtendsVsInterface {
    public static void main(String[] args) {
        LitterMonkey wuKong = new LitterMonkey("悟空");
        wuKong.climbing();
        wuKong.swimming();
        wuKong.flying();
    }
}


//猴子
class Monkey {
    private String name;
    public void climbing() {
        System.out.println("猴子" + name + "会爬树");
    }

    public Monkey(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}

interface Fishable {
    void swimming();
}

interface Birdable {
    void flying();
}

class LitterMonkey extends Monkey implements Fishable,Birdable {

    public LitterMonkey(String name) {
        super(name);
    }

    @Override
    public void swimming() {
        System.out.println(getName() + "通过学习，可以像鱼儿一样游泳");
    }

    @Override
    public void flying() {
        System.out.println(getName() + "通过学习，可以像鸟儿一样飞行");
    }
}